package com.tao.spell.group.controller;

import com.tao.spell.common.utils.PageUtils;
import com.tao.spell.common.utils.R;
import com.tao.spell.group.entity.QianUserEntity;
import com.tao.spell.group.service.QianUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author lc
 * @email sunlightcs@gmail.com
 * @date 2021-09-10 20:29:10
 */
@RestController
@RequestMapping("group/qianuser")
public class QianUserController {
    @Autowired
    private QianUserService qianUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = qianUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{userid}")

    public R info(@PathVariable("userid") Integer userid){
		QianUserEntity qianUser = qianUserService.getById(userid);

        return R.ok().put("qianUser", qianUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody QianUserEntity qianUser){
		qianUserService.save(qianUser);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")

    public R update(@RequestBody QianUserEntity qianUser){
		qianUserService.updateById(qianUser);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] userids){
		qianUserService.removeByIds(Arrays.asList(userids));

        return R.ok();
    }

}
